package me.msz.application.m2copy.constants;

import org.apache.commons.cli.Option;
import org.apache.commons.cli.Options;

/**
 * Created by MeiSZ on 2016/12/9.
 */
public class OptionsManager {
    private static Options optionsInstance = new Options();

    private OptionsManager() {}

    public static Options getOptionsInstance() {
        return optionsInstance;
    }

    static {
        final Option help = Option.builder("h").longOpt("help").hasArg(false)
                .desc("show this information.").build();
        final Option copyAll = Option.builder("a").longOpt("all").hasArg(false)
                .desc("copy all things in maven repository.").build();
        final Option onlyJars = Option.builder("j").longOpt("jars").hasArg(false)
                .desc("only copy the jars in repository, ignoring the menu structures and other files. " +
                        "With option -a, it will copy all the jars to destination folder").build();
        final Option needToCompress = Option.builder("c").longOpt("compress").hasArg(true).argName("algo_name")
                .optionalArg(true).desc("compress the output folder using specified algorithm. " +
                        "Using zip as default algorithm").build();
        final Option clean = Option.builder("C").longOpt("clean").hasArg(false)
                .desc("Clean the copied flags.").build();
        final Option verbose = Option.builder("v").longOpt("verbose").hasArg(false)
                .desc("show the things will be copied.").build();

        final Option mavenRepoPath = Option.builder("s").longOpt("src").hasArg(true).argName("M2_PATH")
                .optionalArg(false).desc("specify maven repository path.").build();
        final Option outputPath = Option.builder("d").longOpt("dest").hasArg(true).argName("dest_path")
                .optionalArg(false).desc("specify output path.").build();

        optionsInstance.addOption(help);
        optionsInstance.addOption(copyAll);
        optionsInstance.addOption(verbose);
        optionsInstance.addOption(onlyJars);
        optionsInstance.addOption(needToCompress);
        optionsInstance.addOption(clean);
        optionsInstance.addOption(mavenRepoPath);
        optionsInstance.addOption(outputPath);
    }
}
